#include "bits/stdc++.h"
using namespace std;

// 一个(n + 1) * m的矩阵，m为方程个数，n为变量个数
// 返回最少用到的方程数
bitset<1004> f[2004];
int gauss(int n, int m) {
	int ret = 0;
	for (int c = 0; c < n; c++) {
		int r = c;
		while (r < m && !f[r][c]) {
			r++;
		}
		// 有多解，或无解
		if (r >= m) {
			return 0;
		}
		ret = max(ret, r + 1);
		if (r != c) {
			swap(f[r], f[c]);
		}
		for (int j = 0; j < m; j++) {
			if (j != c && f[j][c]) {
				f[j] ^= f[c];
			}
		}
	}
	return ret;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < n; j++) {
			if (s[j] == '1') {
				f[i][j] = 1;
			}
		}
		int b;
		cin >> b;
		if (b) {
			f[i][n] = 1;
		}
	}

	int ret = gauss(n, m);
	if (ret == 0) {
		cout << "Cannot Determine";
	} else {
		cout << ret << '\n';
		for (int i = 0; i < n; i++) {
			cout << (f[i][n] ? "?y7M#" : "Earth") << '\n';
		}
	}
	return 0;
}